//
//  DINGNormalStatusCell.swift
//  0730Microblog
//
//  Created by ding on 15/8/11.
//  Copyright © 2015年 ding. All rights reserved.
//

import UIKit

class DINGNormalStatusCell: DINGStatusCell {

    override func prepareHomeCellUI() {
        //MARK: - 图片视图的约束
        super.prepareHomeCellUI()
        pictureView.translatesAutoresizingMaskIntoConstraints = false
        //        contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-10-[targetView]-10-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["targetView" : pictureView]))
        //        contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:[topView]-10-[targetView]-10-[bottomView]", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["topView": contentLabel, "targetView" : pictureView, "bottomView" : bottomView]))
        contentView.addConstraint(NSLayoutConstraint(item: pictureView, attribute: NSLayoutAttribute.Width, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1.0, constant: 100))
        pictureWidthConstraint = contentView.constraints.last
        contentView.addConstraint(NSLayoutConstraint(item: pictureView, attribute: NSLayoutAttribute.Top, relatedBy: NSLayoutRelation.Equal, toItem: contentLabel, attribute: NSLayoutAttribute.Bottom, multiplier: 1.0, constant: 8))
        contentView.addConstraint(NSLayoutConstraint(item: pictureView, attribute: NSLayoutAttribute.Bottom, relatedBy: NSLayoutRelation.Equal, toItem: bottomView, attribute: NSLayoutAttribute.Top, multiplier: 1.0, constant: -8))
        contentView.addConstraint(NSLayoutConstraint(item: pictureView, attribute: NSLayoutAttribute.Left, relatedBy: NSLayoutRelation.Equal, toItem: contentView, attribute: NSLayoutAttribute.Left, multiplier: 1.0, constant: 8))
        contentView.addConstraint(NSLayoutConstraint(item: pictureView, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1.0, constant: 100))
        pictureHeightConstraint = contentView.constraints.last
    }

}
